// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// Copyright (C) 2012	stfour

#ifndef __CFG_H__
#define __CFG_H__
typedef struct cfg
	{
	char *tag;	// if tag is null, value is probably a comment or empty line.
	char *value;
	
	bool comment;
	
	struct cfg *next;
	}
s_cfg;

s_cfg *cfg_Alloc (char *fn, int linebuffsize); // If fn is null, it return an empty structure, otherwise...
bool cfg_Store (s_cfg *c, char *fn);
s_cfg *cfg_NextItem (s_cfg *c);	// return next item in list
void cfg_Free (s_cfg *c); // Free allocated config. stuct
bool cfg_GetInt (s_cfg *cfg, char *tag, int *ival);
bool cfg_GetString (s_cfg *cfg, char *tag, char *string);
bool cfg_SetString (s_cfg *cfg, char *tag, char *string);
s_cfg *cfg_GetItemFromIndex (s_cfg *c, int idx); // return the pointer to item #

void cfg_Debug (s_cfg *c); // Debug an item tree
#endif